package com.wang.tool.monitor.core;

/**
 * @Description
 * @Author shaopeng
 * @Date 2022/11/4
 * @Version 1.0
 */
public class SimpleLinkTransmitter implements LinkTransmitter {

    /**
     * 链路记录tl
     */
    private static final ThreadLocal<LinkInfo> LINK_TL = new ThreadLocal<>();


    @Override
    public LinkInfo get() {
        return LINK_TL.get();
    }

    @Override
    public void set(LinkInfo linkInfo) {
        if (linkInfo == null) {
            LINK_TL.remove();
        } else {
            LINK_TL.set(linkInfo);
        }
    }
}
